<%page expression_filter="h"/>
<%inherit file="../main.html" />
<%namespace name='static' file='../static_content.html'/>
<%!
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.utils import html
from openedx.core.djangolib.markup import Text, HTML
%>

<%block name="pagetitle">${_("User Survey")}</%block>

<%block name="bodyclass">view-survey</%block>

<%block name="js_extra">
  <script type="text/javascript" src="/static/js/course_survey.js"></script>
</%block>

<section class="container">
  <section role="main" class="content-primary">
    <form role="form" id="survey-form" method="post" data-remote="true" action="${postback_url}" novalidate>
      <input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }" />
      <input type="hidden" name="_redirect_url" value="${redirect_url}" />

      % if course:
        <input type="hidden" name="course_id" value="${unicode(course.id)}" />

        <div class="header-survey">
          <h4 class="course-info">
            <span class="course-org">${course.display_org_with_default}</span><span class="course-number"> ${course.display_number_with_default}</span>
            <span class="course-name">${course.display_name}</span>
          </h4>
          <h3 class="title">${_("Pre-Course Survey")}</h3>
        </div>

        <p class="instructions">
          ${_("You can begin your course as soon as you complete the following form. Required fields are marked with an asterisk (*). This information is for the use of {platform_name} only. It will not be linked to your public profile in any way.").format(platform_name=platform_name)}
        </p>
      % endif

      <div role="alert" class="status message submission-error" tabindex="-1">
        <h3 class="message-title">${_("You are missing the following required fields:")} </h3>
        <ul class="message-copy"> </ul>
      </div>

      ${HTML(survey_form)}

      <div class="form-actions">
        <button name="submit" type="submit" id="submit" class="action action-primary action-update">${_('Submit')}</button>
        <a class="action action-cancel" href='${dashboard_redirect_url}'>${_("Cancel and Return to Dashboard")}</a>
      </div>
    </form>
  </section>

    <aside class="content-supplementary" role="complementary">

      <div class="bit">
        <h3 class="title">${_('Why do I need to complete this information?')}</h3>
        <p>
          ${_('We use the information you provide to improve our course for both current and future students. The more we know about your specific needs, the better we can make your course experience.')}
        </p>
      </div>

      <div class="bit">
        <h3 class="title">${_('Who can I contact if I have questions?')}</h3>
        <p>
          ${Text(_("If you have any questions about this course or this form, you can contact {link_start}{mail_to_link}{link_end}.")).format(
                      link_start=HTML('<a href="mailto:{mail_to_link}">').format(mail_to_link=mail_to_link),
                      link_end=HTML('</a>'),
                      mail_to_link=mail_to_link
          )}
        </p>
      </div>
    </aside>

</section>
